home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 1115 < prev    next >
Encoding:
Text File  |  1996-08-06  |  4.0 KB  |  79 lines

  1. Path: fido.asd.sgi.com!austern
  2. From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: sample auto_ptr template
  5. Date: 16 Apr 1996 13:15:34 PDT
  6. Organization: GABI Software, Sarl.
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <KANZE.96Apr16112827@slsvgqt.lts.sel.alcatel.de>
  9. References: <009A04DA6A831C40.49800EAC@ittpub.nl> <bill-0804960932250001@bgibbons.vip.best.com> <4kcr2d$p03@jabba.lehman.com> <KANZE.96Apr10111407@gabi.gabi-soft.fr> <199604121609.MAA27937@jabba.lehman.com> <KANZE.96Apr15103504@gabi.gabi-soft.fr> <xsospe5me40.fsf@juicer.cs.rpi.edu>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: 16 Apr 1996 09:28:26 GMT
  12. In-Reply-To: vandevod@cs.rpi.edu's message of 15 Apr 1996 14:22:46 PDT
  13. Apparently-To: std-c++@ncar.ucar.edu
  14. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  15.     iQBVAwUBMXP/50y4NqrwXLNJAQGwogH/VNppitukSWhXBmIJi+QyI4bDE2WiDMt/
  16.     5MT4aMwbEYBd/zWO4D1odOzZnTPsnxHyOVNDX/vDrac+7nauZbmpCg==
  17.     =GsG9
  18. Originator: austern@isolde.mti.sgi.com
  19.  
  20. In article <xsospe5me40.fsf@juicer.cs.rpi.edu> vandevod@cs.rpi.edu
  21. (David Vandevoorde) writes:
  22.  
  23. |> >>>>> "JK" == J Kanze <kanze@gabi-soft.fr> writes:
  24. |> [...]
  25. |> JK> Well, I agree fully that it is bad programming practice to let
  26. |> JK> exceptions propagate out of a destructor.  At present, however, it
  27. |> JK> is legal C++ (although if the committee were to declare it
  28. |> JK> undefined behavior, they wouldn't get any objections from me), and
  29. |> JK> as such, should be taken into consideration when designing a
  30. |> JK> *standard* library component.  (I *don't* take it into
  31. |> JK> consideration when designing my own components.  But: if you don't
  32. |> JK> like my style, you aren't obliged to use my components.  Everyone
  33. |>                                                              ^^^^^^^^
  34. |> JK> has to use the standard components, however.)
  35. |>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  36. |> I would like to contest that ;-)
  37.  
  38. Yes.  I should have said: everyone should be able to use the standard
  39. components.
  40.  
  41. |> Given the kind of overhead in the ``auto_ptr nouveau'', I'm unlikely
  42. |> to want to use it... and nothing prevents me from that. As far as I
  43. |> know, auto_ptr does not have any connections with the rest of the
  44. |> language (i.e., if it were dropped, there would be no repercussions).
  45. |> Furthermore, it's really not hard to fashion a auto_ptr-like template
  46. |> that fits one's desired semantics.
  47.  
  48. |> In that light, it seems to me that a standard auto_ptr is a little
  49. |> overkill... Fortunately, I'm not forced to use it and so don't care
  50. |> too much.
  51.  
  52. The problem is one of maintainance.  I'm fairly sure that most of the
  53. readers of this forum would have no difficulty crafting a variant of
  54. auto_ptr which is exactly adapted to their particular style.  Doing so,
  55. however, means one more thing to learn for anyone trying to maintain
  56. your code.  So if the standard class comes anywhere close to what I
  57. want or need, I will be using it, instead of my own.
  58.  
  59. Note that almost by definition, a standard class is not optimal for a
  60. particular use.  What makes it valuable as a standard is that it is
  61. adequate for a wide range of uses.  If some part of your application
  62. makes intensive use of this class, you might want to declare a typedef,
  63. to facilitate changing it later, if profiling really does show a
  64. problem.  (My experience is that it's amazing how rarely such things
  65. really are a problem, and that generally, they aren't what you were
  66. expecting anyway.)
  67. -- 
  68. James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
  69. GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
  70. Conseils, Θtudes et rΘalisations en logiciel orientΘ objet --
  71.                 -- A la recherche d'une activitΘ dans une region francophone
  72. ---
  73. [ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
  74.                 newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  75.   comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  76.   Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  77.   Comments? mailto:std-c++-request@ncar.ucar.edu 
  78. ]
  79.